import * as constants from '../Constants'
import { get, GET_TAKEGOODS_LIST, GET_Primary_BY_ID } from '../../service/api'


export interface GetTakeGoodsList {
  type: constants.GetTakeGoodsList
  payload: Promise<any>
}

export interface GetTakeGoodsList_PENDING {
  type: constants.GetTakeGoodsList_PENDING
  payload: Promise<any>
}

export interface GetTakeGoodsList_FULFILLED {
  type: constants.GetTakeGoodsList_FULFILLED
  payload: any
}

export interface GetTakeGoodsList_PAGE {
  type: constants.GetTakeGoodsList_PAGE
  payload: any
}

export interface RECORD_TakeGoods {
  type: constants.RECORD_TakeGoods
  payload: Promise<any>
}

export interface RECORD_TakeGoods_FULFILLED {
  type: constants.RECORD_TakeGoods_FULFILLED
  payload: Promise<any>
}

export type TakeGoodsAction = GetTakeGoodsList | 
  GetTakeGoodsList_FULFILLED | 
  GetTakeGoodsList_PENDING | 
  GetTakeGoodsList_PAGE |
  RECORD_TakeGoods |
  RECORD_TakeGoods_FULFILLED


export function getTakeGoodsList(param: any): GetTakeGoodsList {
  return {
    type: constants.GetTakeGoodsList,
    payload: get(GET_TAKEGOODS_LIST, param)
  }
}
export function recordTakeGoods(param: any): RECORD_TakeGoods {
  return {
    type: constants.RECORD_TakeGoods,
    payload: get(GET_Primary_BY_ID, param)
  }
}
export function page(page: any): GetTakeGoodsList_PAGE {
  return {
    type: constants.GetTakeGoodsList_PAGE,
    payload: page
  }
}